package com.kuang.dao;

import com.kuang.mapper.PositionMapper;
import com.kuang.pojo.Position;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

@Repository
public class PositionDao {
    //模拟数据库中的数据
//    private static Map<Integer, Position> positions = null;
//    static {
//        positions = new HashMap<Integer, Position>();
//
//        positions.put(101,new Position(101,"总经理"));
//        positions.put(102,new Position(102,"董事长"));
//        positions.put(103,new Position(103,"部门经理"));
//        positions.put(104,new Position(104,"总监"));
//        positions.put(105,new Position(105,"员工"));
//    }
    @Autowired
    PositionMapper positionMapper;
    //所有部门的信息
    public Collection<Position> getPositions(){
        return positionMapper.getPositions();
    }

    //通过id得到部门
    public Position getPositionById(Integer id){
        return positionMapper.getPosition(id);
    }
}

